


//-----test-------
#include <stdarg.h>
#include <sstream>
#include "hookproc/impl/win/HookProcManagerImpl_Win.h"
//----------------


#include "hookproc/HookProcManager.h"
#include "hookproc/logger.h"
#include "tools/impl/win/WinExpection.h"

#include <windows.h>
#include <Commctrl.h>

#include <fstream>


using namespace sd::hp;

//TODO void return
#define MAKE_LOGGER(procname,libname)										\
	{																		\
		try																	\
		{																	\
			auto& hook = SD_HP_CREATE_HOOK(procname,libname);				\
			hook.setActive(true);											\
			hook.setCallbackSynth( makeLogger( hook ) );					\
		}catch( const sd::tools::wexception& exp )							\
		{																	\
			logManager::getInstance().log(									\
				std::wstring(L"Error for set hook on '")+L#procname+L"':'"+	\
					L#libname + L"'.  Expection - "+exp.wwhat());			\
		}																	\
	}



void HookMain()
{

	using namespace sd::tools::logger;

	std::wfstream* stream = new std::wfstream("D:\\Project\\sd\\test\\inject_and_hook\\call.logs", std::fstream::out | std::fstream::app); 

	logManager::getInstance().init( *stream );
	HookedProcess::getInstance().setSoftDeactivateMode(true);
	HookedProcess::getInstance().setAutolockingMode(false);

	MAKE_LOGGER(CreateWindowExA,"User32.dll");
	MAKE_LOGGER(CreateWindowExW,"User32.dll");
	MAKE_LOGGER(ShellAboutW,"shell32.dll");
	MAKE_LOGGER(ShellAboutA,"shell32.dll");
	MAKE_LOGGER(WinHelpW,"User32.dll");
	MAKE_LOGGER(WinHelpA,"User32.dll");
    MAKE_LOGGER(CreateStatusWindowW,"comctl32.dll");
	MAKE_LOGGER(GetOpenFileNameW,"comdlg32.dll");
}





